import 'auth_entity.dart';
import 'org_entity.dart';
import 'role_entity.dart';

class UserEntity {
  //人员id
  String userId;
  //姓名
  String name;
  //账号
  String code;
  //昵称
  String nickname;
  //性别
  String sex;
  //电话
  String phone;
  //"微信openId")
  String weixinOperId;
  //头像")
  String avatar;
  //是否实名认证
  String realNameState;
  //身份证号
  String idCard;
  //最后登录时间
  String lastLoginTime;
  //人脸识别标识
  String faceId;

  //备注
  String remark;
  //人员状态+
  String userState = "";
  //资金账户余额+
  String capitalAccount = "";
  //积分账户余额+
  String integralAccount = "";
  //总余额+
  String allAccount = "";
  //电商总余额
  String dsAllAcct = "";
  //上级客户标识+
  String upCustId = "";
  //顶级客户标识+
  String topCustId = "";
  //创建时间
  String createDate;
  //性别名称
  String sexName;
  //是否实名认证名称
  String realNameStateName;
  //人员状态名称+
  String userStateName = "";
  //组织及其地区信息
  OrgEntity org;
  //角色信息
  RoleEntity role;
  //模块列表
  List<AuthEntity> mouldList;
  //令牌
  String token;
  //复购券账户余额
  String reBuyQuanAcct;
  UserEntity(
      {this.weixinOperId,
      this.avatar,
      this.remark,
      this.reBuyQuanAcct,
      this.userState,
      this.capitalAccount,
      this.integralAccount,
      this.allAccount,
      this.upCustId,
      this.topCustId,
      this.createDate,
      this.sexName,
      this.realNameStateName,
      this.userStateName,
      this.org,
      this.role,
      this.mouldList,
      this.token,
      this.userId,
      this.name,
      this.code,
      this.nickname,
      this.sex,
      this.phone,
      this.realNameState,
      this.idCard,
      this.dsAllAcct,
      this.lastLoginTime,
      this.faceId});

  UserEntity.fromJson(Map<String, dynamic> json) {
    userId = json['userId'];
    avatar = json['avatar'];
    name = json['name'];
    code = json['code'];
    nickname = json['nickname'];
    sex = json['sex'];
    phone = json['phone'];
    realNameState = json['realNameState'];
    idCard = json['idCard'];
    lastLoginTime = json['lastLoginTime'];
    faceId = json['faceId'];
    weixinOperId = json['weixinOperId'];
    remark = json['remark'];
    userState = json['userState'];
    capitalAccount = json['capitalAccount'];
    integralAccount = json['integralAccount'];
    allAccount = json['allAccount'];
    dsAllAcct = json['dsAllAcct'];
    upCustId = json['upCustId'];
    topCustId = json['topCustId'];
    createDate = json['createDate'];
    sexName = json['sexName'];
    realNameStateName = json['realNameStateName'];
    userStateName = json['userStateName'];
    org = json['org'] != null ? new OrgEntity.fromJson(json['org']) : null;
    role = json['role'] != null ? new RoleEntity.fromJson(json['role']) : null;
    if (json['mouldList'] != null) {
      mouldList = [];
      json['mouldList'].forEach((v) {
        mouldList.add(new AuthEntity.fromJson(v));
      });
    }
    token = json['token'];
    reBuyQuanAcct = json['reBuyQuanAcct'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['userId'] = this.userId;
    data['avatar'] = this.avatar;
    data['name'] = this.name;
    data['code'] = this.code;
    data['nickname'] = this.nickname;
    data['sex'] = this.sex;
    data['phone'] = this.phone;
    data['realNameState'] = this.realNameState;
    data['idCard'] = this.idCard;
    data['lastLoginTime'] = this.lastLoginTime;
    data['faceId'] = this.faceId;
    data['weixinOperId'] = this.weixinOperId;
    data['remark'] = this.remark;
    data['userState'] = this.userState;
    data['capitalAccount'] = this.capitalAccount;
    data['integralAccount'] = this.integralAccount;
    data['allAccount'] = this.allAccount;
    data['upCustId'] = this.upCustId;
    data['topCustId'] = this.topCustId;
    data['createDate'] = this.createDate;
    data['sexName'] = this.sexName;
    data['realNameStateName'] = this.realNameStateName;
    data['userStateName'] = this.userStateName;
    if (this.org != null) {
      data['org'] = this.org.toJson();
    }
    if (this.role != null) {
      data['role'] = this.role.toJson();
    }
    if (this.mouldList != null) {
      data['mouldList'] = this.mouldList.map((v) => v.toJson()).toList();
    }
    data['token'] = this.token;
    data['reBuyQuanAcct'] = this.reBuyQuanAcct;
    return data;
  }
}
